package cn.iocoder.yudao.module.ym.dal.mysql.sitelog;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ym.dal.dataobject.sitelog.SiteLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ym.controller.admin.sitelog.vo.*;

/**
 * 日志 Mapper
 *
 * @author 韩艳阳
 */
@Mapper
public interface SiteLogMapper extends BaseMapperX<SiteLogDO> {

    default PageResult<SiteLogDO> selectPage(SiteLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SiteLogDO>()
                .likeIfPresent(SiteLogDO::getRemark, reqVO.getRemark())
                .eqIfPresent(SiteLogDO::getDeptId, reqVO.getDeptId())
                .betweenIfPresent(SiteLogDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(SiteLogDO::getSiteId, reqVO.getSiteId())
                .eqIfPresent(SiteLogDO::getStatus, reqVO.getStatus())
                .likeIfPresent(SiteLogDO::getLogContent, reqVO.getLogContent())
                .betweenIfPresent(SiteLogDO::getLogTime, reqVO.getLogTime())
                .eqIfPresent(SiteLogDO::getImage, reqVO.getImage())
                .orderByDesc(SiteLogDO::getId));
    }

    default List<SiteLogDO> selectList(SiteLogPageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<SiteLogDO>()
                .likeIfPresent(SiteLogDO::getRemark, reqVO.getRemark())
                .eqIfPresent(SiteLogDO::getDeptId, reqVO.getDeptId())
                .betweenIfPresent(SiteLogDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(SiteLogDO::getSiteId, reqVO.getSiteId())
                .eqIfPresent(SiteLogDO::getStatus, reqVO.getStatus())
                .likeIfPresent(SiteLogDO::getLogContent, reqVO.getLogContent())
                .betweenIfPresent(SiteLogDO::getLogTime, reqVO.getLogTime())
                .eqIfPresent(SiteLogDO::getImage, reqVO.getImage())
                .orderByDesc(SiteLogDO::getId));
    }

}